package com.qf.pojo;


import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

public class Category implements CheckNull {
  public boolean isEmpty(CheckType type) {
    switch (type){
      case ADD:
        return !StringUtils.hasText(categoryName);
      case UPDATE:
        return ObjectUtils.isEmpty(cId)||cId<0  ||
            (
                !StringUtils.hasText(categoryName)
                &&!StringUtils.hasText(txCommand)
                &&!StringUtils.hasText(rxCommand)
                &&!StringUtils.hasText(commandName)
                &&(ObjectUtils.isEmpty(status)||status<0)
            );
    }
    return false;
  }


    private Long cId;
    private String categoryName;
    private String txCommand;
    private String rxCommand;
    private String commandName;
    private Long status;
    private java.util.Date createTime;
    private String createBy;
    private java.util.Date updateTime;
    private String updateBy;

    @Override
    public String toString() {
        return "Category{" +
                "cId=" + cId +
                ", categoryName='" + categoryName + '\'' +
                ", txCommand='" + txCommand + '\'' +
                ", rxCommand='" + rxCommand + '\'' +
                ", commandName='" + commandName + '\'' +
                ", status=" + status +
                ", createTime=" + createTime +
                ", createBy='" + createBy + '\'' +
                ", updateTime=" + updateTime +
                ", updateBy='" + updateBy + '\'' +
                '}';
    }

    @JsonProperty("cId")
    public Long getCId() {
        return cId;
    }

    @JsonProperty("cId")
    public void setCId(Long cId) {
        this.cId = cId;
    }


    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }


    public String getTxCommand() {
        return txCommand;
    }

    public void setTxCommand(String txCommand) {
        this.txCommand = txCommand;
    }


    public String getRxCommand() {
        return rxCommand;
    }

    public void setRxCommand(String rxCommand) {
        this.rxCommand = rxCommand;
    }


    public String getCommandName() {
        return commandName;
    }

    public void setCommandName(String commandName) {
        this.commandName = commandName;
    }


    public Long getStatus() {
        return status;
    }

    public void setStatus(Long status) {
        this.status = status;
    }


    public java.util.Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(java.util.Date createTime) {
        this.createTime = createTime;
    }


    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }


    public java.util.Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(java.util.Date updateTime) {
        this.updateTime = updateTime;
    }


    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

}
